<!doctype html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="format-detection" content="telephone=no"/>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta name="format-detection" content="telephone=no">
	<title>央票通--领取现金卷</title>
	<style>
		*{
			margin:0;
			padding:0;
		}
		img{
			border:0;
		}
		:focus{
			outline:0;
		}
		body{
			font-family: 'Hiragino Sans GB','Microsoft Yahei',"WenQuanYi Micro Hei",SimSun,Tahoma,Arial,Helvetica,STHeiti;
			font-size:1em;
		}
		.bg,.info,.form{
			position: absolute;
			left:0;
			top:0;
			width:100%;
		}
		.bg img{
			width:100%;
		}
		.info{
			margin-top:2.5em;
			font-size:1em;
			color:#fff;
			line-height:4.125em;
			text-align: center;
		}
		.info img{
			display: block;
			width:60.4vw;
			margin:0 auto;
		}
		.form{
			top:86.667vw;
			margin:0 4%;
			width:92%;
		}
		.form-group{
			margin-bottom:1.1em;
		}
		.form-con,
		.btn{
			width:89.4%;
			height:1em;
			border-radius:.3333em;
			border:none;
			padding:.7222em 5.3%;
			background:#fff;
			font-size:1.125em;
			color:#ccc;
			line-height:1em;
			font-family:"微软雅黑";
		}
		.btn{
			width:100%;
			height:2.4444em;
			background:#ec6f23;
			color:#fff;
		}
	</style>
</head>
<body>
<div class="bg"><img src="./resource/img/receive_bg.jpg" alt=""></div>
<div class="info">

	您的好友<span>{{substr_replace($invite_mobile,'****',3,4)}}</span>送您

	<img src="./resource/img/receive_info.png" alt="">
</div>	
<div class="form">
	<form action="/register" method="post" onsubmit="return fun()">
		<div class="form-group">
			<input type="hidden" value="{{$invite_mobile}}" name="invite_mobile">
			<input type="text" class="form-con" placeholder="请输入您的手机号" id="mobile" name="mobile"><span id="t_mobile"></span>
		</div>
		<div class="form-group">
			<input type="submit" value="立即领取" class="btn" id="submit">
			{{--<input type="submit" id="submit" value="立即领取" class="btn" />--}}
		</div>
	</form>
</div>
</body>
</html>
<script src="./resource/js/jquery-1.11.3.min.js"></script>
<script>
	function fun(){
		var mobile = document.getElementById('mobile').value;
		var reg = /^1[34578]\d{9}$/;
		var status = false;
		if(reg.test(mobile)){
			var ajax = new XMLHttpRequest();
			ajax.onreadystatechange = function () {
				if (ajax.readyState == 4) {
					if (ajax.responseText == 0) {
						document.getElementById("t_mobile").innerHTML = "<span style='color:green'>√</span>";
						status=true
					} else {
						document.getElementById("t_mobile").innerHTML = "<span style='color:red'>该手机号已经注册</span>";
					}
				}
			}
			ajax.open('post', '/check_mobile', false);
			ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			//处理请求
			ajax.send('mobile=' + mobile);
			return status;
		}else{
			document.getElementById("t_mobile").innerHTML = "<span style='color:red'>手机号码格式有误</span>";
			return false;
		}

	}
</script>